package com.mvp.shq.washer.entity;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/9/2.
 */

public class Washer implements Serializable {

    /**
     * id : 1c3df44bc3354ca7a4156b46f4431286
     * washerNo : 123
     * washerType : d97630f11b664ea58c92912821253b78
     * status : 0
     * washerModel : 小天鹅更强洗衣机
     * washerBrand : 小天鹅
     * photos : /userfiles/1/images/photo/2017/08/Koala.jpg
     * address : 福建省福州市闽侯县福建师范大学女生宿舍4#10层
     * detailAddress : 嘻嘻嘻嘻
     */

    private String id;
    private String washerNo;
    private String washerType;
    private String status;
    private String washerModel;
    private String washerBrand;
    private String photos;
    private String address;
    private String detailAddress;
    private String upStatus;
    private String photosList[];

    public static Washer objectFromData(String str) {

        return new Gson().fromJson(str, Washer.class);
    }

    public static List<Washer> arraywasherFromData(String str) {

        Type listType = new TypeToken<ArrayList<Washer>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getWasherNo() {
        return washerNo;
    }

    public void setWasherNo(String washerNo) {
        this.washerNo = washerNo;
    }

    public String getWasherType() {
        return washerType;
    }

    public void setWasherType(String washerType) {
        this.washerType = washerType;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getWasherModel() {
        return washerModel;
    }

    public void setWasherModel(String washerModel) {
        this.washerModel = washerModel;
    }

    public String getWasherBrand() {
        return washerBrand;
    }

    public void setWasherBrand(String washerBrand) {
        this.washerBrand = washerBrand;
    }

    public String getPhotos() {
        return photos;
    }

    public void setPhotos(String photos) {
        this.photos = photos;
    }

    public String getAddress() {
        return address;
    }

    public String getUpStatus() {
        return upStatus;
    }

    public void setUpStatus(String upStatus) {
        this.upStatus = upStatus;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getDetailAddress() {
        return detailAddress;
    }

    public void setDetailAddress(String detailAddress) {
        this.detailAddress = detailAddress;
    }

    public String[] getPhotosList() {
        String str[] = photos.split("\\|");
        for (int i = 0;i < str.length;i ++){
            str[i] = "http://www.uzhixi.com:8080"+str[i];
        }
        return str;
    }

    public void setPhotosList(String[] photosList) {
        this.photosList = photosList;
    }
}
